import { useRoutes } from 'react-router-dom'
import Home from '../views/Home'

import Error from '../views/Error'
import { lazy,Suspense } from 'react'
const About = lazy(()=>import('../views/About'))
const RouterView = () => {
    const routes = useRoutes(
        [
            {
                path: '/',
                element: <Home />
            },
    
            {
                path: '/about',
                element: <Suspense fallback={<div>loading</div>}> <About/></Suspense>
            },
            {
                path: '*',
                element:<Error/> 
            }
        ])
    return routes
}
export default RouterView